Create a function called that generates a randomly varying $x(t)$ signal chosen from a white noise distribution. Call it 'generate_signal' and ensure that it returns $x(t)$ and $X(\omega)$.
The inputs to the function are:
T
: the length of the signal in secondsdt
: the time step in secondsrms
: the root mean square power level of the signal. That is, the resulting signal should have $\sqrt{{1 \over T} \int{x(t)^2}dt}=rms$limit
: the maximum frequency for the signal (in Hz)seed
: the random number seed to use (so we can regenerate the same signal again)Notes:
limit
, set all $X(\omega)$ components with frequencies above the limit to 0rms
, generate the signal, compute its RMS power ($\sqrt{{1 \over T} \int{x(t)^2}dt}=rms$) and rescale so it has the desired power.Create a modified version of your function from question 1.1 that produces noise with a different power spectrum. Instead of having the $X(\omega)$ values be 0 outside of some limit and sampled from $N(\mu=0,\sigma=1)$ inside that limit, we want a smooth drop-off of power as the frequency increases. In particular, instead of the limit
, we sample from $N(\mu=0,\sigma=e^{-{\omega^2/(2*b^2)}})$ where $b$ is the new bandwidth
parameter that replaces the limit
parameter.
Write a program to simulate a single Leaky-Integrate and Fire neuron. The core equation is $ {{dV} \over {dt}} = {1 \over {\tau_{RC}}} (J - V)$ (to simplify life, this is normalized so that $R$=1, the resting voltage is 0 and the firing voltage is 1). This equation can be simulated numerically by taking small time steps (Euler's method). When the voltage reaches the threshold $1$, the neuron will spike and then reset its voltage to $0$ for the next $\tau_{ref}$ amount of time (to plot this, place a dot or line at that time). Also, if the voltage goes below zero at any time, reset it back to zero. For this question, $\tau_{RC}$=0.02 and $\tau_{ref}$=0.002
Since we want to do inputs in terms of $x$, we need to do $J = \alpha e \cdot x + J^{bias}$. For this neuron, set $e$ to $+1$ and find $\alpha$ and $J^{bias}$ such that the firing rate when $x=0$ is 40Hz and when $x=1$ it is 150Hz. To find these $\alpha$ and $J^{bias}$ values, use the approximation for the LIF neuron $a(J)={1 \over {\tau_{ref}-\tau_{RC}ln(1-{1 \over J})}}$.
Write a program that simulates two neurons. The two neurons have exactly the same parameters, except for one of them $e=1$ and for the other $e=-1$. Other than that, use exactly the same settings as in question 2.
Compute the optimal filter for decoding pairs of spikes. Instead of implementing this yourself, here is an implementation in Python and an implementation in Matlab.
Instead of using the optimal filter from the previous question, now we will use the post-synaptic current instead. This is of the form $h(t)=t^n e^{-t/\tau}$ normalized to area 1.
In [ ]: